export default {
  template: `
  <el-menu mode="vertical">
    <el-submenu
      v-for="(submenus, index) in menulist?.rights"
      :index="index + 1"
      :key="submenus.id"
    >
      <template slot="title">{{submenus.authName}}</template>
      <el-menu-item
        v-for="(item, subIndex) in submenus.children"
        :index="(index + 1) + '-' + (subIndex + 1)"
        :key="item.id"
      >
        {{item.authName}}
      </el-menu-item>
    </el-submenu>
  </el-menu>
    `,
  data() {
    return {
      menulist: null,
    };
  },
  created() {
    this.fetchData();
  },
  methods: {
    async fetchData() {
      const data = await fetch(
        "http://localhost:8989/authority/login"
      ).then((res) => res.json());
      console.log(data);
      this.menulist = data;
    },
  },
}